package duotai;

public class Test {
    public static void drawMap1(Shape shape){
        shape.draw();
    }
    public static void drawMap(){
        Ract ract = new Ract();
        Circle circle = new Circle();
        Flower flower = new Flower();
        Shape[] shape = {circle,ract,circle,flower,ract,circle};//向上转型了
        for (Shape shape1:shape){
            shape1.draw();
        }
    }
    public static void main1(String[] args) {
    Ract ract = new Ract();
    Circle circle = new Circle();
    Flower flower = new Flower();
//    drawMap(ract);
//    drawMap(circle);
//    drawMap(flower);

    }
}
class Shape{
    public void draw(){
        System.out.println("画图形");
    }
}
class Ract extends Shape{
    @Override
    public void draw() {
        System.out.println("矩形");
    }
}
class Circle extends Shape{
    @Override
    public void draw() {
        System.out.println("圆形");
    }
}
class Flower extends Shape{
    @Override
    public void draw() {
        System.out.println("❀");
    }
}